package com.develop.data.base.model;

import lombok.*;
import lombok.experimental.SuperBuilder;
import org.hibernate.annotations.ColumnDefault;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.UpdateTimestamp;

import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import java.time.LocalDateTime;

@MappedSuperclass
@Getter
@Setter
@ToString
@RequiredArgsConstructor
@SuperBuilder
@AllArgsConstructor
public abstract class IdSpaceTimeRecord {

    @Id
    @GenericGenerator(name="default", strategy="uuid")
    @GeneratedValue(generator="default")
    @Column(name = "id", nullable = false)
    public String id;

    @Column(name = "create_time", updatable = false)
    @CreationTimestamp
    public LocalDateTime createTime;

    @Column(name = "update_time")
    @UpdateTimestamp
    public LocalDateTime updateTime;

    @Column(name = "coordinate_x")
    public String coordinateX;

    @Column(name = "coordinate_y")
    public String coordinateY;

    @Column(name = "coordinate_z")
    public String coordinateZ;

    @Column(name = "distribution_key")
    public String distributionKey; //跟随其他对象分布

    //@Column(name = "record_namespace", nullable = false) //数据隔离
    @Column(name = "record_namespace") //数据隔离
    public String recordNamespace;

    //@Column(name = "record_group", nullable = false) //数据隔离
    @Column(name = "record_group") //数据隔离
    public String recordGroup;

    //@Column(name = "record_type", nullable = false) //数据隔离
    @Column(name = "record_type") //数据隔离
    public String recordType;

    @Column(name = "record_state")
    public String recordState;

    @Column(name = "record_version")
    public String recordVersion;

}
